$(document).ready(function(){
    var documentOffset = getDocumentOffset();
    if(documentOffset > $("#loading").offset().top - 50)
    {
        loadArticleItems(idArray);
    }
    $(window).bind("scroll",function()
    {
        documentOffset = getDocumentOffset();
        if(idArray == '')
        {
            $("#loading").hide();
            $(window).unbind("scroll");
        }
        else if(documentOffset > $("#loading").offset().top - 50)
        {
            loadArticleItems(idArray);
        }
    });
});